package cn.zf233.jwtshiro.web;

import cn.zf233.jwtshiro.entity.User;
import cn.zf233.jwtshiro.util.JWTUtil;
import cn.zf233.jwtshiro.util.JsonUtil;
import com.auth0.jwt.interfaces.DecodedJWT;

/**
 * Created by zf233 on 2021/7/12
 */
public class BaseController {

    public User loadUser(String token) {
        DecodedJWT decoded = JWTUtil.getToken(token);
        return JsonUtil.toObject(decoded.getClaim("user").asString(), User.class);
    };
}
